package com.amarsoft.are.log;

import com.amarsoft.are.ARE;
import com.amarsoft.are.AREService;
import com.amarsoft.are.AREServiceStub;
import com.amarsoft.are.log.impl.DefaultLogFactory;
import com.xxniu.log.InitLog;

public abstract class LogFactory
  implements AREService
{
  public static final String FACTORY_DEFAULT = "com.amarsoft.are.log.impl.DefaultLogFactory";
  public static final String serviceId = "LOG";
  protected static LogFactory factory = null;
  private static InnerLog innerLog = null;

  public abstract Log getInstance(String paramString)
    throws LogException;

  public abstract void shutdown();

  public static LogFactory getFactory()
    throws LogException
  {
    if (factory == null)
    {
      AREServiceStub localAREServiceStub = ARE.getServiceStub("LOG");
      if (localAREServiceStub != null)
        try
        {
          localAREServiceStub.loadService();
          localAREServiceStub.initService();
        }
        catch (Exception localAREException)
        {
          localAREException.printStackTrace();
        }
      else
        factory = createDefaultFactory();
    }
    return factory;
  }

  public static Log getLog(String paramString)
    throws LogException
  {
    if (InitLog.isInitialized())
      return getFactory().getInstance(paramString);
    return getInnerLog();
  }

  private static Log getInnerLog()
  {
    if (innerLog == null)
      innerLog = new InnerLog();
    return innerLog;
  }

  protected static LogFactory createDefaultFactory()
    throws LogException
  {
    DefaultLogFactory localDefaultLogFactory = null;
    try
    {
      Class<?> localClass = Class.forName("com.amarsoft.are.log.impl.DefaultLogFactory");
      localDefaultLogFactory = (DefaultLogFactory)localClass.newInstance();
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
    }
    return localDefaultLogFactory;
  }

  public String getServiceId()
  {
    return "LOG";
  }

  public final void init()
    throws Exception
  {
    initLogFactory();
    factory = this;
  }

  public abstract void initLogFactory()
    throws Exception;
}

/* Location:           D:\办公软件\反编译工具\jar\are-1.0b96.jar
 * Qualified Name:     com.amarsoft.are.log.LogFactory
 * JD-Core Version:    0.5.3
 */